import * as monaco from 'monaco-editor'

import bwTypescriptOptions from './bwTypescript'

export const createLanguages = (languageId: string) => {
  switch (languageId) {
    case 'bwTypescript': {
      monaco.languages.register({ id: languageId })
      monaco.languages.setMonarchTokensProvider(languageId, bwTypescriptOptions)
      break
    }
    case 'typescript': {
      monaco.languages.typescript.javascriptDefaults.setDiagnosticsOptions({
        noSemanticValidation: true,
        noSyntaxValidation: false,
      })
      monaco.languages.typescript.javascriptDefaults.setCompilerOptions({
        target: monaco.languages.typescript.ScriptTarget.Latest,
        allowNonTsExtensions: true,
      })

      break
    }
    default: {
      break
    }
  }
}
